// HookThread.cpp : implementation file
//

#include "stdafx.h"
#include "FastTab.h"
#include "HookThread.h"
#include "Hook.h"
#include "UserMessage.h"
class ThreadTabDlg : public TabDlg
{
	virtual void NextSelect()
	{
		AfxGetApp()->PostThreadMessage(UserMsg::NextSelect, 0,0);
	}
	virtual void LastSelect()
	{
		AfxGetApp()->PostThreadMessage(UserMsg::LastSelect, 0,0);
	}

	virtual void ConfirmSelect() 
	{
		AfxGetApp()->PostThreadMessage(UserMsg::ConfirmSelect, 0,0);
	}
	virtual void InputKey(DWORD inputKey)
	{
		AfxGetApp()->PostThreadMessage(UserMsg::InputKey, inputKey,0);
	}
	virtual bool IsWindowShow()
	{
		return AfxGetMainWnd()->IsWindowVisible() ? true : false;
	}
};
// HookThread

IMPLEMENT_DYNCREATE(HookThread, CWinThread)

HookThread::HookThread()
{
}

HookThread::~HookThread()
{
}

BOOL HookThread::InitInstance()
{
	mLogic = new TabLogic(mTabDlg = new ThreadTabDlg());
	if(!mLogic->Initialize())
	{
		return FALSE;
	}
	//InputHook::Instance()->SetStartKey(true);
	// TODO:  perform and per-thread initialization here
	return TRUE;
}

int HookThread::ExitInstance()
{
	if(mLogic)
	{
		mLogic->Release();
		delete mLogic;
	}
	if (mTabDlg)
	{
		delete mTabDlg;
		mTabDlg = 0;
	}
	// TODO:  perform any per-thread cleanup here
	return CWinThread::ExitInstance();
}

BEGIN_MESSAGE_MAP(HookThread, CWinThread)

END_MESSAGE_MAP()


// HookThread message handlers
